package com.xunhang.service;

import com.xunhang.entity.News;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xunhang.repository.NewsRepository;
import java.util.List;

@Service
public class SearchService {

    private final NewsRepository newsRepository;

    @Autowired
    public SearchService(NewsRepository newsRepository) {
        this.newsRepository = newsRepository;
    }

    public List<News> searchNews(String keyword) {
        // 使用方法2
        return newsRepository.searchNews(keyword);

    }
}